<cfinclude template="OriginatorDtls.cfm">
<script>
	$(document).ready(function() {
		$( "input[name='Save']" ).click ( function(){checkDate()});	
	});
	
	function checkDate(){
		try{
			var datefrom = new Date($('[name=edtDATEIN]').val() + " " +$('[name=edtTIMEIN]').val());
			var dateto =  new Date($('[name=edtDATEOUT]').val() + " " +$('[name=edtTIMEOUT]').val());
		}catch(e){
			alert('"Date From" should be earlier than "Date To" field.');
			event.preventDefault();
		}
		if(dateto < datefrom) {		
				alert('"Date From" should be earlier than "Date To" field.');
				event.preventDefault();
				
		}
		
		if(!checkTime($('[name=edtTIMEIN]').val())){
			alert('Invalid time');
			event.preventDefault();	
		}
		
		if(!checkTime($('[name=edtTIMEOUT]').val())){
			alert('Invalid time');
			event.preventDefault();	
		}
	}
	
	function checkTime(time){
		return (time.match(/^\d{1,2}[:][0-5][0-9]$/) ? true : false);
			
	}
</script>
</head>

<body>


</body>
</html>
